import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.JedisPoolConfig;

import java.util.HashSet;
import java.util.Set;

/**
 * @author Chenyuhua
 * @date 2020/8/2 23:55
 */
public class JedisMain {
    public static void main(String[] args) {
        JedisPoolConfig config = new JedisPoolConfig();
        Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
        jedisClusterNode.add(new HostAndPort("192.168.230.129", 7001));
        jedisClusterNode.add(new HostAndPort("192.168.230.129", 7002));
        jedisClusterNode.add(new HostAndPort("192.168.230.129", 7003));
        jedisClusterNode.add(new HostAndPort("192.168.230.129", 7004));
        jedisClusterNode.add(new HostAndPort("192.168.230.129", 7005));
        jedisClusterNode.add(new HostAndPort("192.168.230.129", 7006));
        jedisClusterNode.add(new HostAndPort("192.168.230.129", 7007));
        jedisClusterNode.add(new HostAndPort("192.168.230.129", 7008));
        JedisCluster jcd = new JedisCluster(jedisClusterNode, config);
        jcd.set("name:002","zhangfei");
        String value = jcd.get("name:002");
        System.out.println("name:002 :"+value);
    }
}
